package com.bodgittandscarper.broker.types;

import java.io.Serializable;

/**
 * Entity type describing a Record in the database. This interface allows only read access to a Record. 
 * If any modification must be done through the {@link RecordMod} interface.
 * <p>
 * Record objects are created with the {@link TypeFactory}.
 *  
 * @author Morten Rummelhoff
 * @see com.bodgittandscarper.broker.types.TypeFactory
 *
 */
public interface Record extends Serializable {

	/**
	 * Gets an array of fields in this record. The order of the fields in the array corresponds with 
	 * the <code>getDatabaseField(int index)</code> in the <code>DatabaseScheme</code>.  
	 * 
	 * @return an array of fields in this record. 
	 */
	public String[] getRecordFields();
	
	/**
	 * Normally Records with valid flag set to false should not 
	 * be accessible through the <code>BrokerClient</code> boundary. This flag is used internally in the 
	 * {@link suncertify.db.Data} entity class.
	 * 
	 * @return whether or not this record is valid. 
	 */
	public boolean isValid();

	/**
	 * Gets the record number. Every Record gets a record number when it is written to the database. The number depends on how 
	 * many records exist in the database. Deleted record can have their record number re-used by new created records.
	 * 
	 * @return records number
	 */
	public int getRecordNumber();
	
}